package org.mch.swingm.core;

import java.util.ArrayList;
import java.util.List;

import javax.swing.AbstractListModel;

public class MListModel<E> extends AbstractListModel<E> {
	private static final long serialVersionUID = 132757051575664698L;

	private List<E> listData;

	public MListModel() {
		super();
		this.listData = new ArrayList<E>();
	}

	public MListModel(List<E> listData) {
		super();
		this.listData = listData;
	}

	@Override
	public int getSize() {
		return getListData().size();
	}

	@Override
	public E getElementAt(int index) {
		return getListData().get(index);
	}

	public void addElement(E e) {
		getListData().add(e);
	}

	public List<E> getListData() {
		return listData;
	}

	public void clear() {
		getListData().clear();
	}
}
